<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 有效的括号 -->
    <script>
      var isValid = function (s) {
        let len = s.length
        if (len % 2 !== 0) {
          return false
        }
        let length = len / 2
        for (let i = 0; i < length; i++) {
          s = s.replace('()', '')
          s = s.replace('{}', '')
          s = s.replace('[]', '')
        }
        return s.length === 0
      }
      console.log(isValid('({(]])'))
    </script>
  </body>
</html>
